<template>
  <ZZDialog class="settings" title="打印" @close="callbackClose()">
    <el-row :gutter="20">
      <el-col :span="18" :offset="2">
        <el-button type="primary" @click="saveas()" round>另存</el-button>
        <el-button type="primary" @click="prints()" round>打印</el-button>
      </el-col>
    </el-row>
  </ZZDialog>
</template>

<script setup lang="ts">
import { useViewer } from '@/stores/viewer';
import ZZDialog from '@/common/ZZDialog.vue';
import { ElLoading } from 'element-plus';

const viewer: any = useViewer().viewer; //场景视图
let loading: any;
const saveas = () => {
  loading = ElLoading.service({
    lock: true,
    text: '正在导出',
    background: 'rgba(0, 0, 0, 0.7)'
  });
  viewer.zz.expImage();
  loading.close();
};

const prints = () => {
  loading = ElLoading.service({
    lock: true,
    text: '正在打印',
    background: 'rgba(0, 0, 0, 0.7)'
  });
  window.print();
  loading.close();
};
const callbackClose = function () {};
</script>
<style scoped lang="less">
.settings {
  position: absolute;
  top: 100px;
  right: 200px;
  height: 80px;
  width: 200px;
}
</style>
